import Vue from 'vue'
import App from './App'
import store from './store'
import router from './router'

/* import * as obj from 'xx'  这种写法是把所有的输出包裹到obj对象里*/
// 引入自定义指令集
import * as directives from '@/directives/index.js'
// 注册自定义指令集
let key = ''
for (key in directives) {
	Vue.directive(key, directives[key])
}
// Object.keys(directives).forEach(item => {
// 	Vue.directive(item, directives[item])
// })

/* 引入自定义工具（过滤器） */
import * as filters from '@/utils/index.js'
Object.keys(filters).forEach(item => {
	Vue.filter(item, filters[item])
})

/* 注册全局自定义组件 */
// import PageTools from '@/components/PageTools/PageTools.vue'
// Vue.component('PageTools', PageTools)
// 统一引入，统一调用
import myComponents from '@/components/index.js'
Vue.use(myComponents)

import '@/icons' // 引入icon
import '@/permission' // permission control
import '@/styles/index.scss' // 导入全局样式
import 'normalize.css/normalize.css' // 初始化样式
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
/* element响应式 */
import 'element-ui/lib/theme-chalk/display.css'
/* 引入i18n */
import i18n from '@/lang/index.js'
Vue.use(ElementUI, {
	i18n: (key, value) => i18n.t(key, value)
})

/* 引入打印组件 */
import Print from 'vue-print-nb'
Vue.use(Print)

/* 引入mixin */
import miXin from '@/mixin/permission.js'
Vue.mixin(miXin)


Vue.config.productionTip = false

new Vue({
	el: '#app',
	router,
	store,
	i18n,
	render: h => h(App)
})
